<extend name="Layout:base"/>

<block name="title">比赛报名系统</block>

<block name="css">
    <link rel="stylesheet" href="__PUBLIC__/css/top.css">
</block>

<block name="main">
    <div class="container">

        <div class="section" id="mysec">
            <a href="#0" class="cd-top">Top</a>
            <div class="row">
                <div class="input-field col s12">
                    <a class="btn dropdown-button col s12 green lighten-1" href="#!" data-activates="dropdown2">
                        <notempty name="Think.get.deptid">
                            <eq name="Think.get.deptid" value="0">
                                所有部门赛项
                                <else/>
                                {:getDeptName($_GET['deptid'])}
                            </eq>
                            <else/>
                            所有部门赛项
                        </notempty>
                        <i class="mdi-navigation-arrow-drop-down right"></i>
                    </a>
                    <ul id="dropdown2" class="dropdown-content">
                        <li><a href="{:U('Home/Index/index',array('deptid'=>'0'))}">所有部门赛项</a></li>
                        <volist name=":getDept()" id="vo">
                            <li><a href="{:U('Home/Index/index',array('deptid'=>$vo['did']))}">{$vo.name}</a></li>
                        </volist>
                    </ul>
                </div>
            </div>
            <volist name="res" id="vo">
                <div class="row">
                    <div class="col s12">
                        <div class="card-panel hoverable">

                                <div class="left">
                                    <h5>
                                        <a href="{:U('Details/index',array('enid'=>$vo['enid']))}">
                                            <eq name="vo.enclass" value="1">
                                                『个人』
                                                <else/>
                                                『团体』
                                            </eq>
                                            {$vo.title}
                                        </a>
                                    </h5>
                                </div>
                            <div class="right">报名截止时间：<span
                                        class="center-aligne" style="color: red">{:date("Y-m-d",$vo["start"])}~{:date("Y-m-d",$vo["end"])}</span>
                                </div>
                                <div class="clearfix"></div>

                            <div class="valign">
                                <p>&emsp;&emsp;
                                    {:mb_substr(trim(strip_tags($vo["content"])),0,140,'utf-8')}
                                    ……
                                </p>
                            </div>

                            <div class="left" style="color: gray">发布时间：<span
                                    class="mui--divider-right">{:date("Y-m-d",$vo["addtime"])}&nbsp;</span>
                                <eq name="vo.enclass" value="1">
                                    &nbsp;报名人数：
                                    <else/>
                                    &nbsp;报名团队数：
                                </eq>
                                <span>{:sumPeo($vo['enid'],$vo['enclass'])}/{$vo.num}</span>&nbsp;负责老师：<span>{$vo.pri}</span>
                                &nbsp;所属部门：<span>{:getDeptName($vo['deptid'])}</span>
                            </div>

                            <div class="right">
                                <if condition="Is_Enrolled($_SESSION['stuid'],$vo['enclass'],$vo['enid']) gt 0 ">
                                    <a class="waves-effect waves-light btn disabled red">已报名</a>
                                    <else/>
                                    <if condition="sumPeo($vo['enid'],$vo['enclass']) lt $vo['num'] ">
                                        <if condition="time() lt ($vo['end']+86400) ">
                                            <eq name="vo.enclass" value="1">
                                                <a class="waves-effect waves-light btn red"
                                                   href="{:U('Stuform/oneAdd',array('enid'=>$vo['enid']))}"
                                                   onclick="if(confirm('确定报名吗?')==false)return false;">报名</a>
                                                <!--<a class="waves-effect waves-light btn disabled red" href="#">报名</a>-->
                                                <else/>
                                                <a class="waves-effect waves-light btn red"
                                                   href="{:U('Stuform/team',array('enid'=>$vo['enid']))}">报名</a>
                                                <!--<a class="waves-effect waves-light btn disabled red"-->
                                                <!--href="#">报名</a>-->
                                            </eq>
                                            <else/>
                                            <a class="waves-effect waves-light btn disabled red">报名已过期</a>
                                        </if>
                                        <else/>
                                        <a class="waves-effect waves-light btn disabled red">报名已满</a>
                                    </if>
                                </if>

                                <a class="waves-effect waves-light btn  green"
                                   href="{:U('Details/index',array('enid'=>$vo['enid']))}">查看详情</a>
                            </div>
                            <div class="clearfix"></div>


                        </div>
                    </div>
                </div>
            </volist>


            <ul class="pagination center">
                {$page}
            </ul>
        </div>


    </div>

</block>

<block name="js">
    <script>
        $(document).ready(function () {
            $('select').material_select();
        });
    </script>
    <script src="__PUBLIC__/js/top.js"></script> <!-- Gem jQuery -->
</block>
